package com.ajie.slimming.ui;

import android.app.Activity;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;
import android.widget.Toast;

import com.ajie.slimming.R;

public class BaseActivity extends Activity implements OnClickListener {

	/** 页面左上角 */
	protected View title_view_left;
	/** 页面抬头标题 */
	protected TextView title_text;

	protected void showToast(String message) {
		Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
	}

	protected void showToast(int message) {
		Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
	}

	protected void showTitle(int title) {
		title_text = (TextView) findViewById(R.id.title_text);
		title_text.setText(title);
		title_view_left = findViewById(R.id.title_view_left);
		title_view_left.setOnClickListener(this);
	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.title_view_left:
			this.finish();
			break;
		default:
			break;
		}
	}
}
